home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / IPEDITOR.DLL / XML / EXPXL.XSL < prev   
Text File  |  2006-10-27  |  6KB  |  1 lines

  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msoxl="urn:office.microsoft.com:export:xl" xmlns:msoxl2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" extension-element-prefixes="msoxl" version="1.0"> <xsl:output method="xml" version="1.0" encoding="UTF-8" media-type="text/xml"/> <xsl:variable name="columnInfo" select="msoxl:columnInfo()"/> <xsl:variable name="columnSet" select="$columnInfo/ColumnInfo/Column[@Item='Yes' or @Prop='Yes']"/> <xsl:variable name="dataNode" select="msoxl:dataNode()"/> <xsl:variable name="mode" select="msoxl:mode()"/> <xsl:variable name="row" select="1"/> <xsl:variable name="column" select="1"/> <xsl:template match="/"> <xsl:call-template name="Workbook"/> </xsl:template> <xsl:template name="Workbook"> <Workbook> <xsl:if test="$mode = 'Header'"> <xsl:call-template name="ExcelWorkbook"/> <xsl:call-template name="Styles"/> <xsl:call-template name="Maps"/> <xsl:call-template name="Worksheet"/> <msoxl2:insert name="Footer"/> </xsl:if> <xsl:if test="$mode = 'Body'"> <xsl:call-template name="Worksheet"/> </xsl:if> <xsl:if test="$mode = 'Footer'"> <msoxl2:fragment name="Footer"/> </xsl:if> </Workbook> </xsl:template> <xsl:template name="ExcelWorkbook"> <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <ProtectStructure>False</ProtectStructure> <ProtectWindows>False</ProtectWindows> </ExcelWorkbook> </xsl:template> <xsl:template name="Styles"> <Styles> <xsl:element name="Style"> <xsl:attribute name="ss:ID">Default</xsl:attribute> <xsl:attribute name="ss:Name">Normal</xsl:attribute> </xsl:element> <xsl:for-each select="$columnSet"> <xsl:sort select="@Id" data-type="number"/> <xsl:call-template name="Style"/> </xsl:for-each> </Styles> </xsl:template> <xsl:template name="Style"> <xsl:element name="Style"> <xsl:attribute name="ss:ID">ssl<xsl:value-of select="@Id"/></xsl:attribute> </xsl:element> <xsl:element name="Style"> <xsl:attribute name="ss:ID">ssc<xsl:value-of select="@Id"/></xsl:attribute> <xsl:choose> <xsl:when test="@Type='String'"> <xsl:element name="NumberFormat"> <xsl:attribute name="ss:Format">@</xsl:attribute> </xsl:element> </xsl:when> <xsl:when test="@Type='DateTime'"> <xsl:element name="NumberFormat"> <xsl:attribute name="ss:Format">General Date</xsl:attribute> </xsl:element> </xsl:when> <xsl:when test="@Type='Date'"> <xsl:element name="NumberFormat"> <xsl:attribute name="ss:Format">Short Date</xsl:attribute> </xsl:element> </xsl:when> <xsl:when test="@Type='Decimal'"> <xsl:element name="NumberFormat"/> </xsl:when> <xsl:when test="@Type='Time'"> <xsl:element name="NumberFormat"> <xsl:attribute name="ss:Format">[$-F400]h:mm:ss\ AM/PM</xsl:attribute> </xsl:element> </xsl:when> <xsl:when test="@Type='General'"> <xsl:element name="NumberFormat"/> </xsl:when> <xsl:when test="@Type='Integer'"> <xsl:element name="NumberFormat"> <xsl:attribute name="ss:Format">0</xsl:attribute> </xsl:element> </xsl:when> </xsl:choose> </xsl:element> <xsl:element name="Style"> <xsl:attribute name="ss:ID">ssh<xsl:value-of select="@Id"/></xsl:attribute> </xsl:element> </xsl:template> <xsl:template name="Maps"> </xsl:template> <xsl:template name="Worksheet"> <Worksheet ss:Name="Sheet1"> <xsl:call-template name="Table"/> </Worksheet> </xsl:template> <xsl:template name="Table"> <xsl:element name="Table"> <xsl:attribute name="ss:LeftCell"><xsl:value-of select="$column"/></xsl:attribute> <xsl:attribute name="ss:TopCell"><xsl:value-of select="$row"/></xsl:attribute> <xsl:if test="$mode = 'Header'"> <xsl:for-each select="$columnSet"> <xsl:sort select="@Id" data-type="number"/> <xsl:call-template name="Column"/> </xsl:for-each> <xsl:call-template name="Header"/> <msoxl2:insert name="Body"/> </xsl:if> <xsl:if test="$mode = 'Body'"> <msoxl2:fragment name="Body"> <xsl:for-each select="/Table/Row"> <xsl:call-template name="Row"/> </xsl:for-each> </msoxl2:fragment> </xsl:if> </xsl:element> </xsl:template> <xsl:template name="Column"> <xsl:element name="Column"> <xsl:attribute name="ss:StyleID">ssl<xsl:value-of select="@Id"/></xsl:attribute> <xsl:attribute name="ss:AutoFitWidth">1</xsl:attribute> </xsl:element> </xsl:template> <xsl:template name="Header"> <xsl:element name="Row"> <xsl:for-each select="$columnSet"> <xsl:sort select="@Id" data-type="number"/> <xsl:element name="Cell"> <xsl:variable name="Id" select="@Id"/> <xsl:attribute name="ss:StyleID">ssh<xsl:value-of select="$Id"/></xsl:attribute> <xsl:element name="Data"> <xsl:attribute name="ss:Type">String</xsl:attribute> <xsl:value-of select="@name"/> </xsl:element> </xsl:element> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template name="Row"> <xsl:element name="Row"> <xsl:for-each select="Cell"> <xsl:sort select="@Id" data-type="number"/> <xsl:call-template name="Cell"/> </xsl:for-each> </xsl:element> </xsl:template> <xsl:template name="Cell"> <xsl:element name="Cell"> <xsl:variable name="Id" select="@Id"/> <xsl:attribute name="ss:StyleID">ssc<xsl:value-of select="$Id"/></xsl:attribute> <xsl:if test="Data/node() != ''"> <xsl:variable name="type" select="@Type"/> <xsl:element name="Data"> <xsl:attribute name="ss:Type"> <xsl:choose> <xsl:when test="$type = 'Integer'">Number</xsl:when> <xsl:when test="$type = 'Decimal'">Number</xsl:when> <xsl:when test="$type = 'Time'">DateTime</xsl:when> <xsl:when test="$type = 'Date'">DateTime</xsl:when> <xsl:when test="$type = 'General'">String</xsl:when> <xsl:otherwise> <xsl:value-of select="$type"/> </xsl:otherwise> </xsl:choose> </xsl:attribute> <xsl:choose> <xsl:when test="$type = 'Boolean'"> <xsl:if test="Data = 'true' or Data = '1'">1</xsl:if> <xsl:if test="Data = 'false' or Data = '0'">0</xsl:if> </xsl:when> <xsl:when test="$type = 'Time'">1899-12-31T<xsl:value-of select="Data"/></xsl:when> <xsl:otherwise> <xsl:value-of select="Data"/> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:if> </xsl:element> </xsl:template> <xsl:template name="WorksheetOptions"> <x:WorksheetOptions> <x:ProtectObjects>False</x:ProtectObjects> <x:ProtectScenarios>False</x:ProtectScenarios> </x:WorksheetOptions> </xsl:template> </xsl:stylesheet>